package com.longway.core.ext.excel.error;

import java.util.Locale;
import java.util.ResourceBundle;

public class ErrorCode
{
    private String errorResourceBundle;
    private ResourceBundle resource=null;

    public String getErrorResourceBundle()
    {
        return errorResourceBundle;
    }

    public void setErrorResourceBundle(String errorResourceBundle)
    {
        this.errorResourceBundle = errorResourceBundle;
        Locale locale = Locale.getDefault();
        resource=ResourceBundle.getBundle(errorResourceBundle,locale);        
    }

    public String getMessage(int errcode)
    {
        if (resource!=null)
        {
            return resource.getString(String.valueOf(errcode));
        }

        return String.valueOf(errcode);
    }
}
